package com.lightonyoga;

import java.util.ArrayList;

import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import android.widget.ImageView;
//***ListAdapter***
public class ListAdapterMain extends ArrayAdapter<String> { // --
															// CloneChangeRequired
	private ArrayList<String> mList; // --CloneChangeRequired
	private Context mContext;

	public ListAdapterMain(Context context, int textViewResourceId,
			ArrayList<String> list) { // --CloneChangeRequired
		super(context, textViewResourceId, list);
		this.mList = list;
		this.mContext = context;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		View view = convertView;
		String weekNum;
		try {
			if (view == null) {
				LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
				view = vi.inflate(R.layout.list_view, null); // --
																// CloneChangeRequired
																// (
																// list_item
																// )
			}
			final String listItem = mList.get(position); // --
															// CloneChangeRequired
			
			if (listItem != null) {
				// setting list_item views
				weekNum = listItem.toString();
				
				//set name and MAC address
				((TextView) view.findViewById(R.id.tv_description)).setText(weekNum);
				//((TextView) view.findViewById(R.id.tv_name)).setText(Name);
				((TextView) view.findViewById(R.id.tv_rank)).setText(Integer.toString(position+1));
			}
		} catch (Exception e) {
			Log.i("LightOnYoga", e.getMessage());
		}
		return view;
	}
}
